﻿using System.Collections.Generic;

namespace com.binance.client.model.enums
{
	/// <summary>
	/// buy, sell, both.
	/// </summary>

	public sealed class OrderSide
	{
	  public static readonly OrderSide BUY = new OrderSide("BUY", InnerEnum.BUY, "BUY");
	  public static readonly OrderSide SELL = new OrderSide("SELL", InnerEnum.SELL, "SELL");

	  private static readonly IList<OrderSide> valueList = new List<OrderSide>();

	  static OrderSide()
	  {
		  valueList.Add(BUY);
		  valueList.Add(SELL);
	  }

	  public enum InnerEnum
	  {
		  BUY,
		  SELL
	  }

	  public readonly InnerEnum innerEnumValue;
	  private readonly string nameValue;
	  private readonly int ordinalValue;
	  private static int nextOrdinal = 0;

	  private readonly string code;

	  internal OrderSide(string name, InnerEnum innerEnum, string side)
	  {
		this.code = side;

		  nameValue = name;
		  ordinalValue = nextOrdinal++;
		  innerEnumValue = innerEnum;
	  }

	  public override string ToString()
	  {
		return code;
	  }



		public static IList<OrderSide> values()
		{
			return valueList;
		}

		public int ordinal()
		{
			return ordinalValue;
		}

		public static OrderSide valueOf(string name)
		{
			foreach (OrderSide enumInstance in OrderSide.valueList)
			{
				if (enumInstance.nameValue == name)
				{
					return enumInstance;
				}
			}
			throw new System.ArgumentException(name);
		}
	}
}